UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QGIxW+UT3slEww3wjb1Cv0gCjIGNZTHjDSFNiNCE3iA='
WHERE
key_id = '5422acdb2e42948e7fc4dcfb51203902a9cb8e10de3b6264b53384dd92c7ac5a'
AND (
token = 'QGIxW+UT3slEww3wjb1Cv0gCjIGNZTHjDSFNiNCE3iA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)