UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y1eZgjRc8Rg3bEiTQ8WZQg8rIjkrXe2/ONSQz4dwg7M=' 
WHERE 
  key_id = '1537aa4d34e00cdce1813436176bfcaa5ff463083026b031002b4c49b71d2575' 
  AND (
    token = 'y1eZgjRc8Rg3bEiTQ8WZQg8rIjkrXe2/ONSQz4dwg7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023