UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bdj8ehA3hYzsMzw1odEWyl1TcXEo7bjqTCz2ciVEDBA=' 
WHERE 
  key_id = '60af951adc74098a1419dfc9962b4a0cbc744abff6660482e3be3a237989f19c' 
  AND (
    token = 'Bdj8ehA3hYzsMzw1odEWyl1TcXEo7bjqTCz2ciVEDBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028