UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J1lC6ywHFnC0oedHAXNOCSzBmguDcgqK8XffjfacjY4=' 
WHERE 
  key_id = '54366d5d96c564a05c1fdea647490f984bed42f2977ec4ec03f677d30724b142' 
  AND (
    token = 'J1lC6ywHFnC0oedHAXNOCSzBmguDcgqK8XffjfacjY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021