UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CazjLiuEqWMrAKhdhlcUlRLJJpFLkAzA66JDBsJzL0g='
WHERE
key_id = '57f1ccfb03e39f764da108d0700241a8ba3ea45888bb35ca4fe17b04d9f6c647'
AND (
token = 'CazjLiuEqWMrAKhdhlcUlRLJJpFLkAzA66JDBsJzL0g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)