UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ER652e3AJ1f1GIdAZIOV4nLJzT5mVc79RPWWwHbq9NY='
WHERE
key_id = '52312db1b96355b6829e21ff2cc8c3bb6d2a71bc057f12bb2468ec4b43e1ed52'
AND (
token = 'ER652e3AJ1f1GIdAZIOV4nLJzT5mVc79RPWWwHbq9NY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)