UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AnO7UCNnxIIILI5bNgzpX+RFfAAvdhukC6iAE+jbaHI='
WHERE
key_id = 'c108ac12ab5c5e314c0b24e5521d218edc6f9dc4ab76f8dd4a64db7d534f4d02'
AND (
token = 'AnO7UCNnxIIILI5bNgzpX+RFfAAvdhukC6iAE+jbaHI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)