UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BRTUgo1C5aKeWcacpq23ggmIrje5iXEuHebrFMFO0VE=' 
WHERE 
  key_id = 'eec321bc0822fc2770b6c62e121eebd23b5d8f180a063af383cd8d996b76a1f9' 
  AND (
    token = 'BRTUgo1C5aKeWcacpq23ggmIrje5iXEuHebrFMFO0VE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043