UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DAfwN0031B5l9vhgafHmdr8sslQ8db+bkOb52zXsLzE=' 
WHERE 
  key_id = 'e8a0062f76bfa6090cb99793744889dd9be3c5e30c8997f8ca7429171ad3f93c' 
  AND (
    token = 'DAfwN0031B5l9vhgafHmdr8sslQ8db+bkOb52zXsLzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048