UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6/lmMUHxREqgg2Hx1vtiKH619nAsT72W+9W97FX/Qc4='
WHERE
key_id = '8f96b664fcbc9b27cb401d5a7b00e3894eb3b0d434263bcfc48e07d4712314e1'
AND (
token = '6/lmMUHxREqgg2Hx1vtiKH619nAsT72W+9W97FX/Qc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)