UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3aVKlymS7sRiLqZge3D1Y5a/m7IwLWpYLUtRKoqe+mY='
WHERE
key_id = 'd65c9425ee8e5cfe7a391d4d9135017f294a2867665c02336cd2ab7f18678149'
AND (
token = '3aVKlymS7sRiLqZge3D1Y5a/m7IwLWpYLUtRKoqe+mY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)