UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9MmTMn2yx45rF67dO4Oa1MG7xxoeXxq5FPImD5NhT60='
WHERE
key_id = '05cc40bf52a6a8958ca2b1c3489394168edc43997f46938b3ead8bf61a4d7152'
AND (
token = '9MmTMn2yx45rF67dO4Oa1MG7xxoeXxq5FPImD5NhT60='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)