UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PmMH3Rsj6criO8/KKW3h36orlnNwRLCbwzINeY/7rIE='
WHERE
key_id = 'add1728dfde2f4ca020b963c332093de9612f38590f13b440819284a4c1730b5'
AND (
token = 'PmMH3Rsj6criO8/KKW3h36orlnNwRLCbwzINeY/7rIE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)