UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b1bb/JjMTFFpfyGCS3Lq+OOoiENxr4uf6y+bSWuZnT4='
WHERE
key_id = '7017b42ca9b0519685359b20ee13c9b899902297e04ac370dc70c6fe88b5be64'
AND (
token = 'b1bb/JjMTFFpfyGCS3Lq+OOoiENxr4uf6y+bSWuZnT4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)