UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KAP8eF8bvu61wbHgPj2xNrCB7DshgoS+DDj6vrInm4A='
WHERE
key_id = '470580e102ec89800e8be4c3420b4d8a10522213f5ef3bc438e8ff137f889317'
AND (
token = 'KAP8eF8bvu61wbHgPj2xNrCB7DshgoS+DDj6vrInm4A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)