UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V0+EVz0xbMPbiUb4CYlFwMqYe7hhZZPa9zYD7hAGE6M='
WHERE
key_id = 'f7ef5ac008ae317a24ff3124b0a4cc9ec933ca429bab0c1657abaaf3010631dd'
AND (
token = 'V0+EVz0xbMPbiUb4CYlFwMqYe7hhZZPa9zYD7hAGE6M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)