UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N7QbGiT6nd0xpHgmiz/Nd8DtCnHLum3XnDVglpzT7xE='
WHERE
key_id = 'a88d77087ec1ae4fa7d75648cbdafa00c86cc954fff03d60a814209966c60857'
AND (
token = 'N7QbGiT6nd0xpHgmiz/Nd8DtCnHLum3XnDVglpzT7xE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)