UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0koh8uBSzSPNX9ZMb+HBWI/KIgpAf8sq9/OsZo7S+pI='
WHERE
key_id = 'aa87d234c41b6f6e7846b5d1a9fe6ec6b90229a101f616be96a51bc965e463f5'
AND (
token = '0koh8uBSzSPNX9ZMb+HBWI/KIgpAf8sq9/OsZo7S+pI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)