UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5cpUQ/QNCbh5PLxRWGuopmYH15IbtKWEF5kk7kONFZE='
WHERE
key_id = '01f86795e675c7d50f2b525fb365d4a895198a9ff9dd09e85d1c7a23335a75a2'
AND (
token = '5cpUQ/QNCbh5PLxRWGuopmYH15IbtKWEF5kk7kONFZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)