UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lWdAxDQCmrZKqUtAhLLL/TUDVWaHs/0truDnmqJo0ko=' 
WHERE 
  key_id = '6ee1e8b36a8a051d025540b2f36eae1a2c6178879529da19b1194ec580769f1b' 
  AND (
    token = 'lWdAxDQCmrZKqUtAhLLL/TUDVWaHs/0truDnmqJo0ko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031