UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sgLz4Vlh631PTcxnvt+jp88pa8a92PgtNBSWv6TWXKk='
WHERE
key_id = 'f4ae2a5e07cc90f7df02cfad26756eff543c21f896b9d027a07e0973e8b822ed'
AND (
token = 'sgLz4Vlh631PTcxnvt+jp88pa8a92PgtNBSWv6TWXKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)