UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2KvGPfZFiCmwZTCit3a6AWPNYwWZoMCPcIrxawZlwB4='
WHERE
key_id = 'b148a8cfc2bf0a4fe4771c2f4f2eb3a5abde45c34d378a8b5cb2787490e42c8a'
AND (
token = '2KvGPfZFiCmwZTCit3a6AWPNYwWZoMCPcIrxawZlwB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)