UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xnw0cuwZed7uBIcCqKBwOZaiWeVSUgJi7pmz4ypoTT0='
WHERE
key_id = '309082d5c3016ccd99f89b538188d22217dd22099877d4ebbc6480ea3d085116'
AND (
token = 'xnw0cuwZed7uBIcCqKBwOZaiWeVSUgJi7pmz4ypoTT0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)