UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '394iXNlSWVSKJW3zeFjSE0SMEQvssK3vDCyGNvunMMQ='
WHERE
key_id = 'e351ea7965b7c343168afbaef990213e359af2e26bbbaeb34ae5fc4b6f959fe3'
AND (
token = '394iXNlSWVSKJW3zeFjSE0SMEQvssK3vDCyGNvunMMQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)