UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qU+pXe/f6+wqxz0gR21jVwrymjlXPNIOV+vz7hxqIoQ='
WHERE
key_id = 'f166f32bd951e262ff823d8c55f1048406947d303f2f074f7d3fa1e2046e8cb5'
AND (
token = 'qU+pXe/f6+wqxz0gR21jVwrymjlXPNIOV+vz7hxqIoQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)