UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lMzlvNqp1TgZwOZV4HGrl+0GIm+E8yymrymykew+j1k='
WHERE
key_id = '036768da4b738c5ec1934c949f54cd2a5bd6144db0b24c3e180fc31bd1eb9917'
AND (
token = 'lMzlvNqp1TgZwOZV4HGrl+0GIm+E8yymrymykew+j1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)