UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+t1sZ749Raw4oFWUoTHCoH4JLEM2GEAGRlP8OWa+BDE=' 
WHERE 
  key_id = '77b756c0c9bfd2a6642481426da788584f57836d2281c0a38072cdb0b90bd023' 
  AND (
    token = '+t1sZ749Raw4oFWUoTHCoH4JLEM2GEAGRlP8OWa+BDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030