UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't0/jf1md344704DWY+91u+kZ8yixHVHVW9PZA/BS7Uk='
WHERE
key_id = '8f7dd394caa788fd0ed3a1e894660ce35a50babb87ab47b2600275822dcb35d3'
AND (
token = 't0/jf1md344704DWY+91u+kZ8yixHVHVW9PZA/BS7Uk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)