UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BrPLPyEEcS38fA688V63wMPXUaPCpHHr6lITsOvYPvs=' 
WHERE 
  key_id = '77e5d044cb890eb2c74f87a9cd2a46a3d6dc1cc892ff3315a23e6605e3d576ac' 
  AND (
    token = 'BrPLPyEEcS38fA688V63wMPXUaPCpHHr6lITsOvYPvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027