UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VqAK4BQK2QYdpkTxue8PEYDsdKCiOrhEsahbJ8MhWUo=' 
WHERE 
  key_id = 'd41e0114bcb88a2b8267083fab555098e494424672b7eae3adf22e90a1717662' 
  AND (
    token = 'VqAK4BQK2QYdpkTxue8PEYDsdKCiOrhEsahbJ8MhWUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031