UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HMzfSiDUJypE34c7wSlQFlDL+4vf9WjMZL6XE4EkTx4='
WHERE
key_id = 'c4af34fab516a581e59c1f635c7b3a0232b13a801c248ae63a21cd75d6fbac4b'
AND (
token = 'HMzfSiDUJypE34c7wSlQFlDL+4vf9WjMZL6XE4EkTx4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)