UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FCWRw8SWK76mV3cXj4KE4G5/sJqaWR0e2f8zH7RA4Ts=' 
WHERE 
  key_id = '1225afce2d24ddabefc8855cb7314c4f273bb78280942e5d3eabe57993ace976' 
  AND (
    token = 'FCWRw8SWK76mV3cXj4KE4G5/sJqaWR0e2f8zH7RA4Ts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041