UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TgAzL5Two3lwkCA2rxX4vuzCbvs7URWFNlvGn/ejj0w='
WHERE
key_id = '27f0b0e43c1dc85035f4ecb7716ad44f4bf1cadfc07ffa419eabc5cafb1ab92c'
AND (
token = 'TgAzL5Two3lwkCA2rxX4vuzCbvs7URWFNlvGn/ejj0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)