UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tx1AFdHSnDct3GQE3QRdpWOGatDNsQF1bY90fhjDB1E='
WHERE
key_id = '79a550f047737df5939670b8a69fe7ef11e9ad0b31323225f78f768f2270eba0'
AND (
token = 'tx1AFdHSnDct3GQE3QRdpWOGatDNsQF1bY90fhjDB1E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)