UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gw9auJF1kiKKIZWkl4AW8RW6mFbxGTiB6CWO3Z6E9Pc=' 
WHERE 
  key_id = '42e38b5850820705aa761f89b22f76cab8d941864c0a327146e44be9b3cf6036' 
  AND (
    token = 'gw9auJF1kiKKIZWkl4AW8RW6mFbxGTiB6CWO3Z6E9Pc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029