UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'keCZfvCsBrtqy9oo6dbiLsy762n6uL4qfNrNmBnj21A=' 
WHERE 
  key_id = '5451e26ffd05863044b9abda8c63f93c669b1a76539c58ddacb22f82f9d39443' 
  AND (
    token = 'keCZfvCsBrtqy9oo6dbiLsy762n6uL4qfNrNmBnj21A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036