UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G/OCQOKaWisC8z1661BZMirs+gEnn+yyzfA+m3FgRlo='
WHERE
key_id = 'f30df9ca09c9c6deae1527f849e41043d11691b0afa7966bc167a3584583b017'
AND (
token = 'G/OCQOKaWisC8z1661BZMirs+gEnn+yyzfA+m3FgRlo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)