UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'afr6YxeElqzz/NDw2fro7Lj8j7GWU2WZQ4HRyqOp5iI=' 
WHERE 
  key_id = 'de3bd1c5da4d71023d1c6a8dbf3daaa016bb5eaa598ca57d7716d02198468a56' 
  AND (
    token = 'afr6YxeElqzz/NDw2fro7Lj8j7GWU2WZQ4HRyqOp5iI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049