UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KTt0EuQoZcVmLt59i3XrvpD0WuxMXfkJukrZd8Mi9T4='
WHERE
key_id = '01ad691e835dde0c9d38a979c8a4c0f2de2f670ad01f0bb149c26941d5209998'
AND (
token = 'KTt0EuQoZcVmLt59i3XrvpD0WuxMXfkJukrZd8Mi9T4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)