UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ncBXnvJ2E7R3Do3vbVJSDiu0KQNaRbh/yq+enshml9g='
WHERE
key_id = 'aa85eaf23788e1a6b77536e186f51c5af4cd2405dbe6c2c260168774972299dd'
AND (
token = 'ncBXnvJ2E7R3Do3vbVJSDiu0KQNaRbh/yq+enshml9g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)