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

Query time 0.00051