UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HMYRg18JNj3+ZJjZjgUVWTwdddhdvoMbZxwJfDZRk9E='
WHERE
key_id = 'bae4f55d1595e8a75f2e070e5f7ee00b44744e10b59b780c3868c2a2cc6bc002'
AND (
token = 'HMYRg18JNj3+ZJjZjgUVWTwdddhdvoMbZxwJfDZRk9E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)