UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gLZhosmruaAqekSyqHEkxXMoNpty5wgahmmjf3yYpCQ=' 
WHERE 
  key_id = '050eb83a65a77770b96e66e83eb379cc0837f63ef12098204fd75adc892c145f' 
  AND (
    token = 'gLZhosmruaAqekSyqHEkxXMoNpty5wgahmmjf3yYpCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039