UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gm8vqvnzQK7nXvQy+rRgxSxQYDV8yN24BOO6sKZJEVU=' 
WHERE 
  key_id = '71c90f119586d07103e1f07f24556ca85c38d5a1aa1342518d5e729c56135cee' 
  AND (
    token = 'gm8vqvnzQK7nXvQy+rRgxSxQYDV8yN24BOO6sKZJEVU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022