UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dXYWaQBmrJfRWNsOlnVcdb7K4F8J9Wvom8pwLYuqQwU=' 
WHERE 
  key_id = '9735e904110d0e9b5beb5c4fbae99d163fde72d8cad20b331b2ae25fb2504214' 
  AND (
    token = 'dXYWaQBmrJfRWNsOlnVcdb7K4F8J9Wvom8pwLYuqQwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039