UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YHzA6I58i1NXsUM2GizYPf4eWXzcCynZuKdgW2U6Wu0='
WHERE
key_id = 'c74119fa657690af4a324fc4b17c382336052e5b8f0f6f65cd88f1f1c55061f2'
AND (
token = 'YHzA6I58i1NXsUM2GizYPf4eWXzcCynZuKdgW2U6Wu0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)