UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T+3WoLE4mt2Eoef36VVuKUCn7RiB34g6NhMG2DCs83w='
WHERE
key_id = '76b14395ef12bd5e474936da6d6ef87cd38f694f5571b6c5283072e5d84fc7eb'
AND (
token = 'T+3WoLE4mt2Eoef36VVuKUCn7RiB34g6NhMG2DCs83w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)