UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'giFTDGe0ngzvKtrljFIDCH0fxk8GMFaHkjUO9PRxKRE='
WHERE
key_id = 'd443050ad5cf80825aba6937e332e2700b7c73367f6302eba5f6a91d1327fabc'
AND (
token = 'giFTDGe0ngzvKtrljFIDCH0fxk8GMFaHkjUO9PRxKRE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)