UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BKL0N5WSSCzhRz68KI/9cm4tDmm2ySraKCEIOOYa7To='
WHERE
key_id = 'd166c8212376f88c6b68ddf4be29e349db61fa13a918692ee5132f6b3ec4e517'
AND (
token = 'BKL0N5WSSCzhRz68KI/9cm4tDmm2ySraKCEIOOYa7To='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)