UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dv/dbY3zCps+8bkaHT4eANtgo7eVvE8qDG51lD+x3jM=' 
WHERE 
  key_id = 'cd8e5f1a72a3ceea56f46506ad38636e74827bab77cc2b60f85c3b8fec6fb287' 
  AND (
    token = 'dv/dbY3zCps+8bkaHT4eANtgo7eVvE8qDG51lD+x3jM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028