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