UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gMDcNq5cp4TXp7WjCRHfJarasyNLiMKeGEbYrxFMGu4='
WHERE
key_id = 'c3ec7bec1b4cfda19a8511eea408b52464a6cc067056ca9ebbf973c75ce68ccc'
AND (
token = 'gMDcNq5cp4TXp7WjCRHfJarasyNLiMKeGEbYrxFMGu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)