UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'diSIlAExlclfplMd7h+8BiINGC55i3d0qK4XGqzpyuo=' 
WHERE 
  key_id = '8e8be3822947d2562e149615fdf6d81ae4dab481c395865716623e1ba2bf1166' 
  AND (
    token = 'diSIlAExlclfplMd7h+8BiINGC55i3d0qK4XGqzpyuo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019