UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3IZkt7BAvjExMwp+jx92utGR8MS7/IdzconQhmMtSdI=' 
WHERE 
  key_id = 'cb7bf458e030d09ce9b0698f7fded5345a4cd1a5b92b3161f4e0b7419bd7981b' 
  AND (
    token = '3IZkt7BAvjExMwp+jx92utGR8MS7/IdzconQhmMtSdI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036