UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pguVlx5/RbKWE1yNYkwiITgGo75CBropkqDKyv+vAus=' 
WHERE 
  key_id = 'd4fca757b87b89b4b10cefcd4290f0d7fa560ab23910f59a1c9ace5d3bc1e6ce' 
  AND (
    token = 'pguVlx5/RbKWE1yNYkwiITgGo75CBropkqDKyv+vAus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036