UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lJgVbUdwEMqRg/k5PVCrEQAve4Igh4BvH202+TPmfE8='
WHERE
key_id = 'ac0f0ac965a09da6fc38cd931e4e7b064a1943f1a50842558d955030863283a6'
AND (
token = 'lJgVbUdwEMqRg/k5PVCrEQAve4Igh4BvH202+TPmfE8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)