UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'axB5hbx3yFB8+w2TnXe7dLyAYN6g+eLtxO3X+wctW+E='
WHERE
key_id = 'b9a5fe979f7f6336bd5a9457fc6983761e8e021b481fe87930e32bbd4e38c3c3'
AND (
token = 'axB5hbx3yFB8+w2TnXe7dLyAYN6g+eLtxO3X+wctW+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)