UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YaYwC1NB06OjUuyRVoa8A68dZ92d8QwzpE9jHL/zJSs=' 
WHERE 
  key_id = '3aef3f550923ae04373df3fe610f66a80078b2fcee2e00bb0f43d7359773ab04' 
  AND (
    token = 'YaYwC1NB06OjUuyRVoa8A68dZ92d8QwzpE9jHL/zJSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038