UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p9/wyecF3UivT6Sp5wg3e+3EPRguU7ije6lINfsYgC0=' 
WHERE 
  key_id = 'aceed4a9bf66244e99ba28b3738eaaea9c715bf40b09c14158ca4ab48d95f6be' 
  AND (
    token = 'p9/wyecF3UivT6Sp5wg3e+3EPRguU7ije6lINfsYgC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034