UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R3F+YjaUdeOGSYUkQ2PtPSI1i1LqQz26hA7XR4MHOpg=' 
WHERE 
  key_id = 'd8ae7b84a7a9d859c962afa3e3a692278a18c66d64bc8119c357a2e79b384913' 
  AND (
    token = 'R3F+YjaUdeOGSYUkQ2PtPSI1i1LqQz26hA7XR4MHOpg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059